#! /bin/sh
#

USER=ts2
PIDFILE="/var/run/tsnake-antiflood.pid"
WORKDIR="/home/ts2/TSnake/antiflood/"
SCRIPT=/home/ts2/TSnake/antiflood/antiflood.py

case "$1" in
  start)
    echo "Starting TSnake AntiFlood Daemon"
    echo "PIDFILE: $PIDFILE"
    start-stop-daemon --start --background --chuid $USER --make-pidfile --pidfile $PIDFILE --startas /usr/bin/python2.5 -- $SCRIPT
    ;;
  stop)
    echo "Stopping TSnake AntiFlood Daemon"
    start-stop-daemon --stop --pidfile $PIDFILE

    # delete pid file if necessary
    rm -f $PIDFILE
    ;;
  *)
     echo "Usage: /etc/init.d/project_process_mq {start|stop}"
    exit 1
    ;;
esac

exit 0